import React from 'react'
// ===================================================================== Temp
import TableModal from '#cpt/temp/TableModal'
// ===================================================================== global declare
const { $fn } = window
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys: [],
		selectedRows: [],
		forms : [
			{ label: '项目名称',		name: 'item_name',	width:300 },
		]
	}
	
	model = {}
	
	open = kind_id => {
		this.modal.open()
		const { data } = this.state
		if(!$fn.hasArray(data)){
			this.kind_id = kind_id
			this.fetch()
		}else{
			this.table.resize()
		}
	}
	// paging
	fetch = () => $fn.fetch.call(this, 'kd-kind-rel-other/select')
	
	// 表单
	cols = [
		{ title: '项目代码', 	dataIndex: 'kind_code', 	width:100 },
		{ title: '项目名称', 	dataIndex: 'kind_name', 	width:250 },
		{ title: '简称', 		dataIndex: 'short_name', 	width:100 },
		{ title: '英文名称', 	dataIndex: 'name_en', 		width:200 },
		{ title: '项目分类', 	dataIndex: 'category_name', width:100 },
	]
	
	render(){
		return TableModal.call(this,{ title: '添加其它项目', labelWidth:'s7', width:'70%', height:'80%', idStr:'kind_rel_id', api:'kd-kind-rel-other/addbybatch',
			getSubmit: (keys, rows) => ({ kind_id: this.kind_id, kind_rel_id: rows })
		})
	}
}

export default Index